<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">


<link rel="stylesheet" href="../../css/iconfont/iconfont.css">
<link rel="stylesheet" href="../../css/easyui/easyui.css">
<link rel="stylesheet" href="../../css/easyui/icon.css">
<link rel="stylesheet" href="../../css/css.css">
<link rel="stylesheet" href="../../css/site.css">
<link rel="stylesheet" href="../../css/view/equBasic/EquBasic.css">

<script src="../../js/common/jQuery.js"></script>
<script src="../../js/common/jquery.easyui.min.js"></script>
<script src="../../js/common/app.js"></script>
<script src="../../js/common/common.js"></script>
<script src="../../js/common/slidebar.js"></script>
<script src="../../js/common/easyui-lang-zh_CN.js"></script>
<script src="../../js/common/date_format.js"></script>
<!--初始化-->
<script>
	$(function() {
		data_json = null;
		initConseDataGrid(data_json);
	})
	function initConseDataGrid(data_json){
        var parentstore = parent.$("#store").val();
        if(parentstore!="数信网办公室"&&parentstore!="集团办公室"){
            var isornot = document.getElementById("IsOrNotShow");
            isornot.style.display='none';
        }
        if(data_json==null){
            data_json = {
                "parentstore":parentstore
            }
        }
		$.ajax({
		url: "../../goLogis/initPage", //请求的url地址
		xhrFields: {
      				withCredentials: true
   				},
		dataType: "json", //返回格式为json
		type: "GET", //请求方式
		processData: false, //对表单data数据是否进行序列化
		contentType: false, //dataType设置你收到服务器数据的格式
		headers: {
			'Content-Type': 'application/json'
		},
		beforeSend: function() {
			//请求前的处理
		},
		success: function(data) {
			if(data.status=="-1"){
				top.location.href = "../../login.html";
			}else{
                var storejson = data.data;
                var temdata = JSON.parse(storejson);
                var resdata = temdata.arrdata;
                var resdata2 = temdata.arrdata2;
                var data = [];
                var data1 = [];
                //查询门店下拉框（有全部）
                $.each(resdata, function(i,val){
                    //这里的"text","id"和html中对应
                    data.push({ "text": val.ming, "id": val.ming,"selected":val.selected  });
                })

				//新增dialog下拉框（无全部）
                $.each(resdata2, function(i,val){
                    //这里的"text","id"和html中对应
                    data1.push({ "text": val.ming, "id": val.ming,"selected":val.selected  });
                })
                $("#store").combobox("loadData", data);
                $("#Store1").combobox("loadData", data);
                var typedata = [];
                var equtypedata = temdata.equtypedata;
                $.each(equtypedata, function(i,val){
                    //这里的"text","id"和html中对应
                    typedata.push({ "text": val.SetValue, "id": val.SetValue,"selected":val.selected });
                })
                typedata.push({ "text": "全部", "id": "全部","selected":"selected" })
                $("#QEquType").combobox("loadData", typedata);
                $("#TEquType").combobox("loadData", typedata);
                // $("#AStore").combobox("loadData", data1);
            }

		},
		complete: function() {
			//请求完成的处理
		},
		error: function() {
		}
	});
        if(data_json==null){
            data_json = {"parentstore":parentstore};
		}else{
            data_json.parentstore = parentstore;
		}

		$("#dg").datagrid({
			onDblClickRow: function(rowIndex, rowData) {
				var row = $('#dg').datagrid('getSelected');
				var id = row.ID;
				var equId = row.EquId;
				var DocNo = row.DocNo;
				var ConseType = row.ConseType;
				var ConseReason = row.ConseReason;
				var DocStatus = row.DocStatus;
				var ConseTime = row.ConseTime;
				var ConseResult = row.ConseResult;
				var Cost = row.Cost;
				if(DocStatus=="执行中"){
					DocStatus = "2";
				}
				if(DocStatus=="执行完毕"){
					DocStatus = "3";
				}
				var jsondata = {
					"EquId": equId,
					"DocNo": DocNo
				};
				var data_json = JSON.stringify(jsondata);

				if(DocStatus == 2) {
					$("#CDocNo").attr("value", DocNo);
					$("#CConseType").attr("value", ConseType);
					$("#CConseReason").attr("value", ConseReason);
					$.ajax({
						url: "../../goLogis/queryBasicEquById", //请求的url地址
						dataType: "json", //返回格式为json
						data: data_json, //参数值
						type: "POST", //请求方式
						processData: false, //对表单data数据是否进行序列化
						contentType: false, //dataType设置你收到服务器数据的格式
						headers: {
							'Content-Type': 'application/json'
						},
						beforeSend: function() {
							//请求前的处理
						},
						success: function(data) {
							$("#DEquName").attr("value", data.EquName);
							$("#DLifeTime").attr("value", data.LifeTime);
							$("#DStartTime").attr("value", data.StartTime);
							$("#DEndTime").attr("value", data.EndTime);
							$("#DBuyInMoney").attr("value", data.BuyInMoney);
							$("#DLastConseTime").attr("value", data.LastConseTime);
							$("#DNextConseTime").attr("value", data.NextConseTime);
							$("#DEquType").attr("value", data.EquType);
							$("#DPurchaseType").attr("value", data.PurchaseType);
							$("#DStore").attr("value", data.Store);
							$("#DEquStatus").attr("value", data.EquStatus);
							$("#DEquNo").attr("value", data.EquNo);
							$("#DConsePeriod").attr("value", data.ConsePeriod);
							$("#DSpecification").attr("value", data.Specification);
							$("#DPlace").attr("value", data.Place);
							$("#DServCondition").attr("value", data.ServCondition);
							$("#DBuyInTime").attr("value", data.BuyInTime);
							$("#DEquId").attr("value", data.ID);
							$('#queryConseDocDialog').dialog('open');
						},
						complete: function() {
							//请求完成的处理
						},
						error: function() {
							//请求出错处理
						}
					});
				}

				if(DocStatus == 3) {
						$("#DSDocNo").attr("value", DocNo);
						$("#DSConseType").attr("value", ConseType);
						$("#DSConseReason").attr("value", ConseReason);
						$("#DSConseTime").attr("value", ConseTime);
						$("#DSConseResult").attr("value", ConseResult);
                    	$("#DSCost").attr("value", Cost);
						$.ajax({
							url: "../../goLogis/queryBasicEquById", //请求的url地址
							dataType: "json", //返回格式为json
							data: data_json, //参数值
							type: "POST", //请求方式
							processData: false, //对表单data数据是否进行序列化
							contentType: false, //dataType设置你收到服务器数据的格式
							headers: {
								'Content-Type': 'application/json'
							},
							beforeSend: function() {
								//请求前的处理
							},
							success: function(data) {
								$("#DSEquName").attr("value", data.EquName);
								$("#DSLifeTime").attr("value", data.LifeTime);
								$("#DSStartTime").attr("value", data.StartTime);
								$("#DSEndTime").attr("value", data.EndTime);
								$("#DSBuyInMoney").attr("value", data.BuyInMoney);
								$("#DSLastConseTime").attr("value", data.LastConseTime);
								$("#DSNextConseTime").attr("value", data.NextConseTime);
								$("#DSEquType").attr("value", data.EquType);
								$("#DSPurchaseType").attr("value", data.PurchaseType);
								$("#DSStore").attr("value", data.Store);
								$("#DSEquStatus").attr("value", data.EquStatus);
								$("#DSEquNo").attr("value", data.EquNo);
								$("#DSConsePeriod").attr("value", data.ConsePeriod);
								$("#DSSpecification").attr("value", data.Specification);
								$("#DSPlace").attr("value", data.Place);
								$("#DSServCondition").attr("value", data.ServCondition);
								$("#DSBuyInTime").attr("value", data.BuyInTime);
								$("#DSEquId").attr("value", data.ID);
								// $("#DSConseTime").attr("value", data.ConseTime);
								// $("#DSConseReason").attr("value", data.ConseReason);
								// $("#DSConseResult").attr("value", data.ConseResult);
								$("#DSCost").attr("value", data.Cost);
								$('#queryConseSuccessDocDialog').dialog('open');
							},
							complete: function() {
								//请求完成的处理
							},
							error: function() {
								//请求出错处理
							}
						});
					}

			},
			url:"../../goLogis/queryAllConseDoc",
			method: "POST",
			queryParams:data_json,
			singleSelect: false, //如果为true，则只允许选择一行。
			ctrlSelect: true, //在启用多行选择的时候允许使用Ctrl键+鼠标点击的方式进行多选操作。
			// fitColumns: true, //真正的自动展开/收缩列的大小，以适应网格的宽度，防止水平滚动。
			striped: true, //是否显示斑马线效果
			/* loadMsg:"Processing, please wait …", */ //在从远程站点加载数据的时候显示提示消息。
			rownumbers: true, //如果设置为true则会添加一列来显示行号。
			pagination: true, //如果为true，则在DataGrid控件底部显示分页工具栏。
			pageSize: 15, //在设置分页属性的时候初始化页面数据条数。
			pageList: [15], //在设置分页属性的时候 初始化页面数据显示条数选择列表
			toolbar: '#tb',
            showFooter:true,
			columns: [
				[
					//这里的field对应的是后台的字段属性
					{
						field: "ID",
						title: "ID",
						width: 50,
						checkbox: true
					},
                    {
                        field: "DocNo",
                        title: "作业编号",
                        width: 100
                    },
                    {
                        field: "Store",
                        title: "中心店面",
                        width: 100
                    },
                    {
                        field: "EquName",
                        title: "设备名称",
                        width: 70
                    },
                    {
                        field: "EquType",
                        title: "设备类别",
                        width: 70
                    },
					{
						field: "DocStatus",
						title: "作业状态",
						width: 80
					},
					{
						field: "CreateTime",
						title: "创建时间",
						width: 100
					},
                    {
                        field: "ConseTime",
                        title: "完成时间",
                        width: 100
                    },
					{
						field: "ConseType",
						title: "维护类型",
						width: 100
					},
                    {
                        field: "Cost",
                        title: "费用",
                        width: 100
                    },
					{field:'deleteBasic',title:'操作',width:80,
			            formatter:function(value,rec){
			                var btn = '<a class="editcls" onclick="deleteOneRow(\''+rec.ID+'\',\''+rec.DocStatus+'\')" href="javascript:void(0)">删除</a>';
                			return btn;
			            }
			        },
				]
			]
		});
		var pager = $('#dg').datagrid('getPager');
		$(pager).pagination({
            pageSize: 15,
            pageList: [15],
            onSelectPage:function(pageNumber, pageSize){
                var rows = pageSize;
                var page = pageNumber;
                $.ajax({
                    type: "post",
                    data:data_json,
                    async: false,
                    url: "../../goLogis/queryAllConseDoc?rows="+rows+"&page="+page,
                    dataType: "json",
                    /*jsonp: "callback",
                    jsonpCallback:"callback",*/
                    success: function(data){
                        $('#dg').datagrid('loadData',data);
                    },
                    error: function(xhr){
                       /* error(xhr.responseText);*/
                    }
                });
            },
            beforePageText: '第', //页数文本框前显示的汉字
			afterPageText: '页    共 {pages} 页',
            displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
        });


	//	第三层弹框资产信息
        $("#threedialogdg").datagrid({
            onDblClickRow: function(rowIndex, rowData) {
                var row = $('#threedialogdg').datagrid('getSelected');
                $("#EquNo").attr("value",row.EquNo);
                $("#AStore").attr("value",row.Store);

                $('#ThreeDialog').dialog('close');
                $('#saveConseDocDialog').dialog('open');
            },
            rowStyler:function(index,row){
                s1  =  row.BuyInTime;
                var s2 = new Date();
                var sc = s2.Format("yyyy-MM-dd");
                var s3 = row.LastConseTime;
                if(!(typeof(s3)=="undefined")){
                    if((row.ConsePeriod-DateDiff(s3,sc))<=20){
                        return 'background-color:yellow;';
                    }
                }
                if((row.LifeTime*365-DateDiff(s1,sc))<=0){
                    return 'background-color:red;';
                }
            },
            url: "../../goLogis/queryAllBasicEqu2",
            method: "POST",
            queryParams:data_json,
            singleSelect: false, //如果为true，则只允许选择一行。
            ctrlSelect: true, //在启用多行选择的时候允许使用Ctrl键+鼠标点击的方式进行多选操作。
            // fitColumns: true, //真正的自动展开/收缩列的大小，以适应网格的宽度，防止水平滚动。
            striped: true, //是否显示斑马线效果
            /* loadMsg:"Processing, please wait …", */ //在从远程站点加载数据的时候显示提示消息。
            rownumbers: true, //如果设置为true则会添加一列来显示行号。
            pagination: true, //如果为true，则在DataGrid控件底部显示分页工具栏。
            pageSize: 15, //在设置分页属性的时候初始化页面数据条数。
            pageList: [15], //在设置分页属性的时候 初始化页面数据显示条数选择列表
            toolbar: '#threetb',
            columns: [
                [
                    {
                        field: "Store",
                        title: "中心店面",
                        width: 100
                    },
                    {
                        field: "EquNo",
                        title: "设备编号",
                        width: 100
                    },
                    {
                        field: "EquName",
                        title: "资产名称",
                        width: 100
                    },
                    {
                        field: "EquType",
                        title: "设备类别",
                        width: 100
                    },
                    {
                        field: "Place",
                        title: "存放地点",
                        width: 100
                    },
                    {
                        field: "LifeTime",
                        title: "寿命（年）",
                        width: 50
                    },
                    {
                        field: "StartTime",
                        title: "开始使用时间",
                        width: 150
                    },
                    {
                        field: "EndTime",
                        title: "使用截止日期",
                        width: 150
                    },
                    {
                        field: "BuyInTime",
                        title: "购入日期",
                        width: 150
                    },
                    {
                        field: "ServCondition",
                        title: "使用状况",
                        width: 80
                    },
                ]
            ]
        });
        var pager = $('#threedialogdg').datagrid('getPager');
        $(pager).pagination({
            pageSize: 15,
            pageList: [15],
            onSelectPage: function(pageNumber, pageSize) {
                var rows = pageSize;
                var page = pageNumber;
                $.ajax({
                    type: "post",
                    data: data_json,
                    async: false,
                    url: "../../goLogis/queryAllBasicEqu2?rows=" + rows + "&page=" + page,
                    dataType: "json",
                    // jsonp: "callback",
                    // jsonpCallback: "callback",
                    success: function(data) {
                        $('#threedialogdg').datagrid('loadData', data);
                    },
                    error: function(xhr) {
                    }
                });
            },
            beforePageText: '第', //页数文本框前显示的汉字
            afterPageText: '页    共 {pages} 页',
            displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
        });
	}

	//初始化第三层弹框信息
	function initThree(data_json){
        $("#threedialogdg").datagrid({
            onDblClickRow: function(rowIndex, rowData) {
                var row = $('#threedialogdg').datagrid('getSelected');
                $("#EquNo").attr("value",row.EquNo);
                $("#AStore").attr("value",row.Store);

                $('#ThreeDialog').dialog('close');
                $('#saveConseDocDialog').dialog('open');
            },
            rowStyler:function(index,row){
                s1  =  row.BuyInTime;
                var s2 = new Date();
                var sc = s2.Format("yyyy-MM-dd");
                var s3 = row.LastConseTime;
                if(!(typeof(s3)=="undefined")){
                    if((row.ConsePeriod-DateDiff(s3,sc))<=20){
                        return 'background-color:yellow;';
                    }
                }
                if((row.LifeTime*365-DateDiff(s1,sc))<=0){
                    return 'background-color:red;';
                }
            },
            url: "../../goLogis/queryAllBasicEqu3",
            method: "POST",
            queryParams:data_json,
            singleSelect: false, //如果为true，则只允许选择一行。
            ctrlSelect: true, //在启用多行选择的时候允许使用Ctrl键+鼠标点击的方式进行多选操作。
            // fitColumns: true, //真正的自动展开/收缩列的大小，以适应网格的宽度，防止水平滚动。
            striped: true, //是否显示斑马线效果
            /* loadMsg:"Processing, please wait …", */ //在从远程站点加载数据的时候显示提示消息。
            rownumbers: true, //如果设置为true则会添加一列来显示行号。
            pagination: true, //如果为true，则在DataGrid控件底部显示分页工具栏。
            pageSize: 15, //在设置分页属性的时候初始化页面数据条数。
            pageList: [15], //在设置分页属性的时候 初始化页面数据显示条数选择列表
            toolbar: '#threetb',
            columns: [
                [
                    {
                        field: "Store",
                        title: "中心店面",
                        width: 100
                    },
                    {
                        field: "EquNo",
                        title: "设备编号",
                        width: 100
                    },
                    {
                        field: "EquName",
                        title: "资产名称",
                        width: 100
                    },
                    {
                        field: "EquType",
                        title: "设备类别",
                        width: 100
                    },
                    {
                        field: "Place",
                        title: "存放地点",
                        width: 100
                    },
                    {
                        field: "LifeTime",
                        title: "寿命（年）",
                        width: 50
                    },
                    {
                        field: "StartTime",
                        title: "开始使用时间",
                        width: 150
                    },
                    {
                        field: "EndTime",
                        title: "使用截止日期",
                        width: 150
                    },
                    {
                        field: "BuyInTime",
                        title: "购入日期",
                        width: 150
                    },
                    {
                        field: "ServCondition",
                        title: "使用状况",
                        width: 80
                    },
                ]
            ]
        });
        var pager = $('#threedialogdg').datagrid('getPager');
        $(pager).pagination({
            pageSize: 15,
            pageList: [15],
            onSelectPage: function(pageNumber, pageSize) {
                var rows = pageSize;
                var page = pageNumber;
                $.ajax({
                    type: "post",
                    data: data_json,
                    async: false,
                    url: "../../goLogis/queryAllBasicEqu3?rows=" + rows + "&page=" + page,
                    dataType: "json",
                    // jsonp: "callback",
                    // jsonpCallback: "callback",
                    success: function(data) {
                        $('#threedialogdg').datagrid('loadData', data);
                    },
                    error: function(xhr) {
                    }
                });
            },
            beforePageText: '第', //页数文本框前显示的汉字
            afterPageText: '页    共 {pages} 页',
            displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
        });
	}

	function deleteOneRow(conserveid,conserveDocStatus){
        	if(conserveDocStatus=="执行完毕"){
        		$.messager.alert("提示","当前单据已执行，不可删除")
        	}
        	if(conserveDocStatus=="执行中"){
        		var jsondata = {
        			"ID":conserveid
        		}
        		var data_json = JSON.stringify(jsondata);
        		$.ajax({
				url: "../../goLogis/deleteConseveById", //请求的url地址
				dataType: "json", //返回格式为json
				data: data_json, //参数值
				type: "POST", //请求方式
				processData: false, //对表单data数据是否进行序列化
				contentType: false, //dataType设置你收到服务器数据的格式
				headers: {
					'Content-Type': 'application/json'
				},
				beforeSend: function() {
					//请求前的处理
				},
				success: function(data) {
					if(data.status=="1"){
						$.messager.alert('提示', "删除成功");
						$("#dg").datagrid('reload');
					}else{
						$.messager.alert('提示', "删除失败，请重新尝试");
					}
				},
				complete: function() {
					//请求完成的处理
				},
				error: function(data) {
					//请求出错处理
				}
			});
        	}
        }
</script>

<!--查询页datagrid-->
<div>
	<table id="dg" style="width: 1148px;"></table>
</div>

<!--操作按钮-->
<div id="tb" style="padding:2px 5px;">
	<div style="margin-left: 20px;float:left" id="IsOrNotShow">
		中心店面<select id="store" class="easyui-combobox" panelHeight="auto" style="width:100px" data-options="valueField:'id', textField:'text'" editable="false">
	</select>
	</div>
	<div style="margin-left: 20px;float:left">
		类别
		<select id="QEquType" class="easyui-combobox"  style="width:100px" panelHeight="auto" data-options="valueField:'id', textField:'text'" editable="false">
		</select>
	</div>
	<div style="margin-left: 20px;float:left" >
		作业状态<select id="QDocStatus" panelHeight="auto" style="width:100px" class="easyui-combobox" editable="false">
		<option value="">全部</option>
		<option value="3">执行完毕</option>
		<option value="2">执行中</option>
	</select>
	</div>
	<div style="margin-left: 20px;float:left">
		维护类型
		<select id="QConseType" class="easyui-combobox"  style="width:100px" panelHeight="auto" editable="false">
			<option value="">全部</option>
			<option value="1">定期维保</option>
			<option value="2">更换备件</option>
			<option value="3">报废更换</option>
		</select>
	</div>
	<div style="margin-left: 20px;float:left">
        完成日期:<input type="text" id="CreateStartDate"   name="CreateStartDate" class="easyui-datebox" editable="false">
    </div>
    <div style="margin-left: 20px;float:left">
        到&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" id="CreateEndDate" name="CreateEndDate" class="easyui-datebox" editable="false">
    </div>


    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="queryConseListByCondition()">查询</a>
    <script>
        function queryConseListByCondition() {
        	var CreateStartDate = $("#CreateStartDate").val();
        	var CreateEndDate = $("#CreateEndDate").val();
            var store = $('#store').combobox('getText');
            var DocStatus = $("#QDocStatus").val();
            var EquType = $('#QEquType').combobox('getText');
            var ConseType = $("#QConseType").val();
            if(EquType=="全部"){
                EquType = null;
            }
        	var jsondata = {
        		"store":store,
        		"CreateStartDate":CreateStartDate,
        		"CreateEndDate":CreateEndDate,
				"DocStatus":DocStatus,
				"EquType":EquType,
				"ConseType":ConseType
        	}
        	initConseDataGrid(jsondata);
        }
    </script>
    <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="reset()">重置</a>
    <script>
        function reset() {
            var CreateStartDate = $("#CreateStartDate");
            CreateStartDate.datebox("setValue","");
            var CreateEndDate = $("#CreateEndDate");
            CreateEndDate.datebox("setValue","");
        	jsondata = null;
            initConseDataGrid(jsondata);
        }
    </script>
    <a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="addConseDoc()">新增</a>
	<script>
		function addConseDoc() {
			var timestamp = Date.parse(new Date());
			$("#ADocNo").attr("value", timestamp);
            var u = parent.$("#username").val();
            $("#InputMan").attr("value",u);
            var parentstore = parent.$("#store").val();
            if(parentstore=="集团办公室"||parentstore=="数信网办公室"){

			}else{
                $("#AStore").attr("value",parentstore);
            }
			$('#saveConseDocDialog').dialog('open');
		}
	</script>
	<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="inportexcel()">导出</a>
	<script>
        function inportexcel(){
            var CreateStartDate = $("#CreateStartDate").val();
            var CreateEndDate = $("#CreateEndDate").val();
            var store = $('#store').combobox('getText');
            if(store=='全部'){
                store = null;
            }
            var DocStatus = $("#QDocStatus").val();
            var EquType = $('#QEquType').combobox('getText');
            var ConseType = $("#QConseType").val();
            if(EquType=="全部"){
                EquType = null;
            }
            window.location.href="../../goLogis/CreateConseExcel?CreateStartDate="+CreateStartDate+"&CreateEndDate="+CreateEndDate+"&store="+store+"&DocStatus="+DocStatus+"&EquType="+EquType+"&ConseType="+ConseType;
        }

	</script>


</div>
<!--添加资产dialog-->
<div id="ThreeDialog" class="easyui-dialog" title="添加资产" style="width: 930px; height: 500px;text-align:center;top:50px;display: none;overflow: hidden;" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,closable:true ">
	<div id="tb1" style="padding:2px 5px;">
		<div style="margin-left: 20px;float:left" id="IsOrNotShow1">
			中心店面<select id="Store1" class="easyui-combobox" panelHeight="auto" style="width:100px" data-options="valueField:'id', textField:'text'" editable="false">
		</select>
		</div>
		<div style="margin-left: 20px;float:left">
			类别
			<select id="TEquType" class="easyui-combobox"  style="width:100px" panelHeight="auto" data-options="valueField:'id', textField:'text'" editable="false">
			</select>
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="queryTConseListByCondition()">查询</a>
		</div>
		<script>
			function queryTConseListByCondition() {
				var EquType = $('#TEquType').combobox('getText');
				if(EquType=="全部"){
					EquType = null;
				}
                var Store = $('#Store1').combobox('getText');
                var parentStore = parent.$("#store").val();
                if(parentStore=="集团办公室"||parentStore=="数信网办公室"){

                }
				var jsondata = {
					"store":Store,
					"EquType":EquType,
					"parentstore":parentStore
				}
                initThree(jsondata);
			}
		</script>
	</div>
	<div>
		<table id="threedialogdg" style="width: 900px;"></table>
	</div>
</div>
<!--新增维修单dialog-->
<div id="saveConseDocDialog" class="easyui-dialog" title="添加维修单" style="width: 930px; height: 500px;text-align:center;top:50px;display: none;overflow: hidden;" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,closable:true ">

	<div>
		<table width="900" height="60" class="BuyBack">
			<tr>
				<td width="109" height="36" class="odd"><span>作业编号</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="ADocNo" /></span></td>
				<td width="84" class="odd"><span>资产编号</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="EquNo" readonly="readonly" onclick="openThreeDialog()"/></span></td>
				<script>
  					function openThreeDialog() {
  					    // $("#threedialogdg").datagrid("reload",{});
                        $('#ThreeDialog').dialog('open');
                    }
				</script>
	             <td width="84" class="odd"><span>中心店面</span></td>
				<td width="127" class="even"><span>
					<input type="text" id="AStore" readonly="readonly"  style="width:100px" ,panelHeight="auto"  />
					</span></td>
				<td width="87" class="odd"><span>维护类型</span></td>
				<td width="127" class="even"><span><select class="easyui-combobox" id="ConseType" editable="false">
	            	<option value="1">定期维保</option>
	            	<option value="2">更换备件</option>
					<option value="3">报废更换</option>
	            </select></span></td>
			</tr>
			<tr style="display: none">
				<td width="87" class="odd"><span>录入人</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
														  id="InputMan" readonly="" /></span></td>
			</tr>
		</table>
	</div>
	<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="subConseDoc()" style="text-align: left;">提交</a>
	<!--提交维修单-->
	<script>
		function subConseDoc() {
			var DocNo = $("#ADocNo").val();
			var EquNo = $("#EquNo").val().trim();
            if(EquNo==""){
                $.messager.alert("提示","设备编号不能为空");
                return false;
            }
            var ConseType = $("#ConseType").val();
			var ConseReason = $("#ConseReason").val();
			var Store = $('#AStore').val();
			var InputMan = $("#InputMan").val();
			var parentStore = parent.$("#store").val();
			if(parentStore=="集团办公室"||parentStore=="数信网办公室"){

			}else{
                if(Store!=parentStore){
                    $.messager.alert("提示","不能录入与录入人所在中心店面不同的中心店面资产")
                    return false;
                }
            }
			var jsondata = {
				"parentstore":parentStore,
				"DocNo": DocNo,
				"EquNo": EquNo,
				"ConseType": ConseType,
				"Store": Store,
				"InputMan":InputMan,
				"ConseReason": ConseReason
			};
			var data_json = JSON.stringify(jsondata);
			$.ajax({
				url: "../../goLogis/saveConseDoc", //请求的url地址
				dataType: "json", //返回格式为json
				data: data_json, //参数值
				type: "POST", //请求方式
				processData: false, //对表单data数据是否进行序列化
				contentType: false, //dataType设置你收到服务器数据的格式
				headers: {
					'Content-Type': 'application/json'
				},
				beforeSend: function() {
					//请求前的处理
				},
				success: function(data) {
					$.messager.alert('提交维修单', data.status);
					$("#dg").datagrid('reload');
					$('#saveConseDocDialog').dialog('close');
				},
				complete: function() {
					//请求完成的处理
				},
				error: function(data) {
					//请求出错处理
				}
			});
		}
	</script>
</div>

<!--执行维修单dialog-->
<div id="queryConseDocDialog" class="easyui-dialog" title="资产详细资料" style="width: 930px; height: 500px;text-align:center;top:50px;display: none;overflow: hidden;" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,closable:true ">
	<div style="width:70%;text-align: left;">
		<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="closeDiv1()">关闭</a>
		<script>
			function closeDiv1() {
				$('#queryConseDocDialog').dialog('close');
			}
		</script>
		<a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="subDlg()">执行完成</a>
		<script>
			function subDlg() {
				var ConseTime = $("#FConseTime").val().toString();
				var ConseResult = $("#FConseResult").val();
				var Cost = $("#FCost").val();
				var ConseReason = $("#FConseReason").val();
				var DocNo = $("#CDocNo").val();
				var EquId = $("#DEquId").val();
				var ConseType = $("#CConseType").val();
                if(ConseTime==null|ConseTime==""){
                    $.messager.alert("提示","请输入完成时间");
                    return false;
                }
                if(ConseReason==null|ConseReason==""){
                    $.messager.alert("提示","请输入维护原因");
                    return false;
                }
                if(ConseResult==null|ConseResult==""){
                    $.messager.alert("提示","请输入审批人(文件)");
                    return false;
                }
                if(Cost==null|Cost==""){
                    $.messager.alert("提示","请输入花费");
                    return false;
                }
				if(isNaN(Cost)){
				    $.messager.alert("提示","花费选项必须填写为数字");
				    return false;
				}
				var jsondata = {
					"ConseTime": ConseTime,
					"ConseResult": ConseResult,
					"Cost": Cost,
					"ConseReason": ConseReason,
					"DocNo": DocNo,
					"EquId": EquId,
					"ConseType": ConseType
				};
				var data_json = JSON.stringify(jsondata);
				$.ajax({
					url: "../../goLogis/saveConseDocAndConseCourse", //请求的url地址
					dataType: "json", //返回格式为json
					data: data_json, //参数值
					type: "POST", //请求方式
					processData: false, //对表单data数据是否进行序列化
					contentType: false, //dataType设置你收到服务器数据的格式
					headers: {
						'Content-Type': 'application/json'
					},
					beforeSend: function() {
						//请求前的处理
					},
					success: function(data) {

						$.messager.alert('执行维护', data.status, 'info');
						$("#dg").datagrid('reload');
						$('#queryConseDocDialog').dialog('close');

					},
					complete: function() {
						//请求完成的处理
					},
					error: function(data) {
					}
				});
			}
		</script>
	</div>
	<!--资产基本信息-->
	<div>
		<div class="panel-header" style="width:918px;text-align: left;">
			<div class="panel-title">资产基本信息</div>
			<div class="panel-tool"></div>
		</div>
		<table width="900" height="149" class="BuyBack">
			<tr>
				<td width="109" height="36" class="odd"><span>资产名称</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DEquName" /></span></td>
				<td width="84" class="odd"><span>寿命（年）</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DLifeTime"/></span></td>
				<td width="87" class="odd"><span>开始使用时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DStartTime"/></span></td>
				<td width="87" class="odd"><span>截止使用时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                     id="DEndTime"/></span></td>
			</tr>
			<tr>
				<td width="109" height="36" class="odd"><span>购入价格（元）</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DBuyInMoney" /></span></td>
				<td width="109" height="36" class="odd"><span>购入时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
														  id="DBuyInTime" /></span></td>
				<td width="87" class="odd"><span>使用状况</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
														  id="DServCondition"/></span></td>
				<!--<td width="84" class="odd"><span>最后一次完成时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DLastConseTime"/></span></td>
				<td width="87" class="odd"><span>下次完成时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DNextConseTime"/></span></td>-->
				<td width="87" class="odd"><span>设备类型</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                     id="DEquType"/></span></td>
			</tr>
			<tr>
				<td width="109" height="36" class="odd"><span>购置方式</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DPurchaseType" /></span></td>
				<td width="84" class="odd"><span>中心店面</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DStore"/></span></td>
				<td width="87" class="odd"><span>所处状态</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DEquStatus"/></span></td>
				<td width="87" class="odd"><span>设备编号</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                     id="DEquNo"/></span></td>
			</tr>
			<tr>
				<td width="109" height="36" class="odd"><span>维护周期（年）</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DConsePeriod" /></span></td>
				<td width="84" class="odd"><span>规格</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSpecification"/></span></td>
				<td width="87" class="odd"><span>存放地点</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DPlace"/></span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px; display: none;" readonly="readonly"
														  id="DEquId" /></span></td>
			</tr>
		</table>
	</div>

	<!--维修单信息-->
	<div style="clear: both;"></div>
	<div>
		<div class="panel-header" style="width:918px;text-align: left;">
			<div class="panel-title">维修单信息</div>
			<div class="panel-tool"></div>
		</div>
		<table width="auto" height="auto" class="BuyBack">
			<tr>
				<td width="109" height="36" class="odd"><span>作业编号</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="CDocNo" readonly="readonly"/></span></td>
				<td width="84" class="odd"><span>维护类型</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="CConseType" readonly="readonly"/></span></td>
			</tr>
		</table>
	</div>
	<!--提交维修单需填信息-->
	<div style="clear: both;"></div>
	<div>
		<div class="panel-header" style="width:918px;text-align: left;">
			<div class="panel-title">需填信息</div>
			<div class="panel-tool"></div>
		</div>
		<table width="auto" height="auto" class="BuyBack">
			<tr>
				<td width="109" height="36" class="odd"><span>完成时间</span></td>
				<td width="127" class="even"><span><input type="datetime"  class="easyui-datebox" editable="false" style="width: 120px;height: 23px"
	                                                      id="FConseTime" required="required"/></span></td>
				<td width="87" class="odd"><span>维护原因</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="FConseReason" required="required"/></span></td>
				<td width="87" class="odd"><span>审批人(文件)</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="FConseResult" required="required"/></span></td>
				<td width="87" class="odd"><span>花费（元）</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="FCost" required="required"/></span></td>
			</tr>
		</table>
	</div>

</div>

<!--查看已执行维修单-->
<div id="queryConseSuccessDocDialog" class="easyui-dialog" title="资产详细资料" style="width: 930px; height: 500px;text-align:center;top:50px" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true,closable:true ">
	<div style="width:70%;text-align: left;">
		<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="closeDiv2()">关闭</a>
		<script>
			function closeDiv2() {
				$('#queryConseSuccessDocDialog').dialog('close');
			}
		</script>
	</div>
	<!--资产基本信息-->
	<div>
		<div class="panel-header" style="width:918px;text-align: left;">
			<div class="panel-title">资产基本信息</div>
			<div class="panel-tool"></div>
		</div>
		<table width="900" height="149" class="BuyBack">
			<tr>
				<td width="109" height="36" class="odd"><span>资产名称</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSEquName" /></span></td>
				<td width="84" class="odd"><span>寿命</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSLifeTime"/></span></td>
				<td width="87" class="odd"><span>开始使用时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSStartTime"/></span></td>
				<td width="87" class="odd"><span>截止使用时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                     id="DSEndTime"/></span></td>
			</tr>
			<tr>
				<td width="109" height="36" class="odd"><span>购入价格</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSBuyInMoney" /></span></td>
				<td width="109" height="36" class="odd"><span>购入时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
														  id="DSBuyInTime" /></span></td>
				<!--<td width="84" class="odd"><span>最后一次完成时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSLastConseTime"/></span></td>
				<td width="87" class="odd"><span>下次完成时间</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSNextConseTime"/></span></td>-->
				<td width="87" class="odd"><span>使用状况</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
														  id="DSServCondition"/></span></td>
				<td width="87" class="odd"><span>设备类型</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                     id="DSEquType"/></span></td>
			</tr>
			<tr>
				<td width="109" height="36" class="odd"><span>购置方式</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSPurchaseType" /></span></td>
				<td width="84" class="odd"><span>中心店面</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSStore"/></span></td>
				<td width="87" class="odd"><span>所处状态</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSEquStatus"/></span></td>
				<td width="87" class="odd"><span>设备编号</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                     id="DSEquNo"/></span></td>
			</tr>
			<tr>
				<td width="109" height="36" class="odd"><span>维护周期</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSConsePeriod" /></span></td>
				<td width="84" class="odd"><span>规格</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSSpecification"/></span></td>
				<td width="87" class="odd"><span>存放地点</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px" readonly="readonly"
	                                                      id="DSPlace"/></span></td>
				<td width="127" class="even" style="display: none;"><span><input type="text" style="width: 120px;height: 23px; display: none;" readonly="readonly"
														  id="DSEquId" /></span></td>
			</tr>
		</table>
	</div>

	<!--维修单信息-->
	<div style="clear: both;"></div>
	<div>
		<div class="panel-header" style="width:918px;text-align: left;">
			<div class="panel-title">维修单信息</div>
			<div class="panel-tool"></div>
		</div>
		<table width="auto" height="auto" class="BuyBack">
			<tr>
				<td width="109" height="36" class="odd"><span>作业编号</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="DSDocNo" readonly="readonly"/></span></td>
				<td width="84" class="odd"><span>维护类型</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="DSConseType" readonly="readonly"/></span></td>
			</tr>
		</table>
	</div>
	<!--提交维修单需填信息-->
	<div style="clear: both;"></div>
	<div>
		<div class="panel-header" style="width:918px;text-align: left;">
			<div class="panel-title">维修执行信息</div>
			<div class="panel-tool"></div>
		</div>
		<table width="auto" height="auto" class="BuyBack">
			<tr>
				<td width="109" height="36" class="odd"><span>完成时间</span></td>
				<td width="127" class="even"><span><input type="text"  style="width: 120px;height: 23px"
	                                                      id="DSConseTime" readonly="readonly"/></span></td>
				<td width="87" class="odd"><span>维护原因</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="DSConseReason" readonly="readonly"/></span></td>
				<td width="87" class="odd"><span>审批人(文件)</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="DSConseResult" readonly="readonly"/></span></td>
				<td width="87" class="odd"><span>花费</span></td>
				<td width="127" class="even"><span><input type="text" style="width: 120px;height: 23px"
	                                                      id="DSCost" readonly="readonly"/></span></td>
			</tr>
		</table>
	</div>

</div>